package com.mk.service.web;

import act.controller.Controller;
import com.github.d925529.apidoc.ApiHttpMethod;
import com.github.d925529.apidoc.annotation.*;
import com.mk.domain.CuArticle;
import org.osgl.mvc.annotation.GetAction;
import org.osgl.mvc.annotation.With;

import javax.inject.Inject;
import java.util.Map;

/**
 * 说明：前台接口
 * 作者：刘永盛
 * 日期：2018-7-26 9:11:17
 * 版本：1.0.0
 */
@Controller("cuArticle")
@Api(group = "wb", title = "文章", path = "/cuArticle")
@SuppressWarnings("unused")
public class CuArticleService extends BaseWebService {
    @Inject
    private CuArticle.Mapper cuArticleMapper;

    @With(WbILogin.class)
    @GetAction("view.json")
    @ApiParam(name = "caid", title = "文章id", type = String.class)
    @ApiMethod(title = "查询首页公共数据", path = "/view.json", method = ApiHttpMethod.GET)
    @ApiReturn(description = "", type = Map.class, maps = {
        @ApiMap(name = "article", title = "文章详情", type = CuArticle.class)
    })
    public Map<String, Object> view(String caid) {
        Map<String, Object> cuArticle = cuArticleMapper.viewArticle(caid);
        cuArticleMapper.updateReadCnt(caid);
        return cuArticle;
    }

}
